package com.sdleyou.treepro.manager.api.pet;

import com.sdleyou.treepro.common.model.dto.PetDTO;
import com.sdleyou.treepro.common.model.utils.ResultVOUtil;
import com.sdleyou.treepro.common.model.vo.ResultVO;
import com.sdleyou.treepro.common.service.PetManager;
import com.sdleyou.treepro.system.version.ApiVersion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 地图控制器
 *
 * @author gx
 * @version v1.0
 * 2020年2月21日
 */
@RestController
@RequestMapping("/api")
public class ManagerPetController {
    @Autowired
    private PetManager petManager;

    @ApiVersion(1)
    @PostMapping("/{version}/manager/pet")
    public ResultVO createPet(@RequestBody PetDTO petDTO) {
        petManager.createPet(petDTO);
        return ResultVOUtil.success();
    }

    @ApiVersion(1)
    @PutMapping("/{version}/manager/pet/{pet_id}")
    public ResultVO updatePet(@RequestBody PetDTO petDTO,
                              @PathVariable("pet_id") String petId) {
        petManager.updatePet(petDTO, petId);
        return ResultVOUtil.success();
    }
}
